package com.wl.dzt.basic.datachange;

import com.wl.dzt.sys.core.dao.datachange.DataChangeter;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author wl_code@163.com
 * @version 1.0
 * @date 2018/6/29/029
 * @description 模块树形列表数据改变, 改变模块图标
 */
@Component
public class BasicModelChangeter implements DataChangeter {

    public List<Map<String, Object>> change(List<Map<String, Object>> data) {
        data.forEach(map -> {
            map.put("iconCls", "fa " + map.get("modelIcon"));
            List<Map<String, Object>> children = (List<Map<String, Object>>) map.get("children");
            if (children.size() >= 1) {
                change(children);
            }
        });
        return data;
    }
}
